# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=textdistance
pkgname=python-${_pkg}
pkgver=4.5.0
pkgrel=2
pkgdesc="Compute distance between sequences"
arch=(any)
url="https://github.com/life4/textdistance"
license=(MIT)
depends=(
    python-abydos
    python-jellyfish
    python-numpy
    python-levenshtein
    python-pyxdameraulevenshtein
)
makedepends=(python-setuptools)
checkdepends=(
    python-pytest
    python-hypothesis
    python-isort
    python-pylev
    python-py_stringmatching
    python-tabulate
)
# PyPi tarballs do not have the tests
#source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
source=(${url}/archive/${pkgver}/${_pkg}-${pkgver}.tar.gz)
sha256sums=('847138105603af8f7b711498ce215d36f016512e37351b071b8867a46b3906e7')

build() {
  cd ${_pkg}-${pkgver}
  python setup.py build
}

check() {
  cd ${_pkg}-${pkgver}
  # Failing tests, reported by email
  pytest --deselect tests/test_external.py
}

package() {
  cd ${_pkg}-${pkgver}
  python setup.py install --prefix=/usr --root="${pkgdir}" --skip-build --optimize=1
  install -Dm644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}
}
